﻿@page "/sdk/objects/page/m/{RecordId}/{PageName?}"

@model WebVella.Erp.Plugins.SDK.Pages.Page.ManageModel
@using WebVella.TagHelpers.Models;
@using WebVella.Erp.Web.Utils;
@{
	Layout = "~/Pages/_AppMaster.cshtml";
	ViewData["Title"] = "Manage Page";
	var pageIconClass = "fa fa-file";
	if (!String.IsNullOrWhiteSpace(Model.ErpPage.IconClass))
	{
		pageIconClass = Model.ErpPage.IconClass;
	}

}
<wv-page-header color="#dc3545" area-label="Pages" title="@Model.ErpPage.Label" subtitle="Manage"
				icon-class="@pageIconClass" return-url="@Model.ReturnUrl">

	<wv-page-header-actions>
		<wv-button type='Submit' form="ManageRecord" class='btn btn-blue btn-sm'><span class='fa fa-save go-white'></span> Save Page</wv-button>
		<a href='@Html.Raw(Model.ReturnUrl)' class='btn btn-white btn-sm'>Cancel</a>
	</wv-page-header-actions>

	<wv-page-header-toolbar>
		@foreach (var action in Model.HeaderToolbar)
		{
			@Html.Raw(action)
		}
	</wv-page-header-toolbar>
</wv-page-header>

<wv-validation errors="@Model.Validation.ToErrorList()" message="@Model.Validation.Message"></wv-validation>

<wv-form id="ManageRecord" name="ManageRecord" validation-errors="Model.Validation.ToErrorList()" label-mode="Stacked" mode="Form">
	<wv-section class="mt-4" title="General" is-card="true">
		<wv-row>
			<wv-column span="6">
				<wv-field-text label-text="Name" value="@Model.Name" name="Name" required="true"></wv-field-text>
			</wv-column>
			<wv-column span="6">
				<wv-field-text label-text="Label" value="@Model.Label" name="Label" required="true"></wv-field-text>
			</wv-column>
		</wv-row>
		<wv-row>
			<wv-column span="6">
				<wv-field-icon label-text="Icon CSS Class" value="@Model.IconClass" name="IconClass"></wv-field-icon>
			</wv-column>
			<wv-column span="6">
				<wv-field-number label-text="Weight" decimal-digits="0" value="@Model.Weight" name="Weight" description="if > 1000 will not be part of navigation"></wv-field-number>
			</wv-column>
		</wv-row>
		<wv-row>
			<wv-column span="6">
				<wv-field-text label-text="Layout" value="@Model.Layout" name="Layout"></wv-field-text>
			</wv-column>
		</wv-row>
		<wv-row>
			<wv-column>
				<wv-field-textarea label-text="Description" value="@Model.Description" name="Description"></wv-field-textarea>
			</wv-column>
		</wv-row>
	</wv-section>
	<wv-section class="mt-4" title="Sitemap" is-card="true">
		@await Component.InvokeAsync("WvSdkPageSitemap", new { pageId = Model.RecordId, mode = WvFieldRenderMode.Form })
	</wv-section>
	@*<wv-section class="mt-4" title="Render" is-card="true">
			<wv-row>
				<wv-column span="12">
					<wv-field-code label-text="RazorBody" value="@Model.RazorBody" name="RazorBody"></wv-field-code>
				</wv-column>
			</wv-row>
		</wv-section>*@
</wv-form>

